package com.woniu.woniuticket.controller;


import com.woniu.woniuticket.entity.Xiankan;
import com.woniu.woniuticket.service.IXiankanService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author spirit
 * @since 2020-02-27
 */
@Controller
//@RequestMapping("/woniuticket/xiankan")
@CrossOrigin("*")
public class XiankanController {

    @Resource
    private IXiankanService xiankanService;

    @RequestMapping("selectxk")
    @ResponseBody
    public List findx(Integer studentId){

        List<Xiankan> xiankan=xiankanService.selectxk(studentId);
        System.out.println(xiankan);
        return xiankan;
    }

    @RequestMapping("selectxkmo")
    @ResponseBody
    public List findxkmo(Integer movieId){
        List<Xiankan> xkmo=xiankanService.selectxkmo(movieId);
        System.out.println(xkmo);
        return xkmo;
    }

    @RequestMapping("insertxk")
    @ResponseBody
    public int findi(Integer movieId,Integer studentId,String movieName,String movieTrailerPath,Integer xkStatus){
        int ins=xiankanService.insertxk(movieId,studentId,movieName,movieTrailerPath,xkStatus);
        System.out.println(ins);

        return ins;
    }

    @RequestMapping("deletexk")
    @ResponseBody
    public int findd(Integer movieId){
        int delete=xiankanService.deletexk(movieId);
        System.out.println(delete);

        return delete;
    }


}

